<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<style>
			#box{
				width:400px;
				height:300px;
				border:1px solid red;
			}
		</style>
		<script>
			window.onload = function(){
				var oBox = document.getElementById("box");
				var btn = document.getElementsByTagName('input')[0];
				btn.onclick = function(){
//					如果不传或者传false克隆自己.传true克隆我和我的子孙
					var newNode = oBox.cloneNode(true);
					console.log(newNode);
					document.body.appendChild(newNode);
				}
			}
		</script>
	</head>
	<body>
		<input type="button" value="复制" />
		<div id="box">
			<span>我是span <a href="">我是a</a></span>
			<p>我是P</p>
		</div>
	</body>
</html>















